//
// Created by ancho on 2021/11/6.
//

#include <iostream>
#include <math.h>

using namespace std;

double cal_hum(double temp, double dew){
    double e = 6.11 * exp(5417.7530 * (1/273.16-1/(dew+273.16)));
    double h = 0.5555 * (e-10.0);
    return temp + h;
}
double cal_temp(double dew,double hum){
    double e = 6.11 * exp(5417.7530 * (1/273.16-1/(dew+273.16)));
    double h = 0.5555 * (e-10.0);
    return hum - h;

}

double cal_dew(double temp,double hum){

    double dew = 0,eps=100;
    for(;eps > 1e-5;eps /=2){
        if(cal_hum(temp,dew) > hum ) dew -=eps;
        else dew += eps;
    }
    return dew;
}

int main2() {

    char a,b;
    double A,B,temp,hum,dew;
    cin >> a>>A>>b>>B;
    while (a && a != 'E') {
        temp=dew=hum=-9999;
        if(a=='T') temp=A;
        if(a=='D') dew=A;
        if(a=='H') hum=A;
        if(b=='T') temp=B;
        if(b=='D') dew=B;
        if(b=='H') hum=B;
        if (temp == -9999) {
            temp=cal_temp(dew,hum);
        } else if (dew == -9999) {
            dew=cal_dew(temp,hum) ;
        }else{
            hum=cal_hum(temp,dew);
        }
        printf("T %0.1lf D %0.1lf H %0.1lf\n",temp,dew,hum);
        cin >> a>>A>>b>>B;
    }


    return 0;
}
